<template>
  <div class="vue-set">
    <p @click="addd(obj)">{{obj.d}}</p>
    <p @click="adde(obj)">{{obj.e}}</p>
  </div>
</template>
<script>
export default {
  name: "vueSet",
  data() {
    return {
      obj: {}
    }
  },
  mounted() {
    this.obj = {d: 0}
    // this.obj.e = 0
    // console.log("after-----", this.obj)
    // 所以我们可以这样修改
    this.$set(this.obj, 'e', 0)
  },
  methods: {
    addd(item) {
      item.d = item.d + 1
      console.log("item---", item)
    },
    adde(item) {
      item.e = item.e + 1
      console.log("item---", item)
    }
  }
}
</script>